package com.lanqiao.javaparkinglot.dao;

import com.lanqiao.javaparkinglot.entity.Driver;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Mapper
public interface DriverDao {
    //查询
    @Select("select * from tb_driver")
    List<Driver> findsj();

    //添加
    @Update("insert into tb_driver (sj_eno, sj_style, sj_number, sj_brand, sj_name, sj_tele, sj_carplace) VALUES (#{sj_eno}, #{sj_style}, #{sj_number}, #{sj_brand}, #{sj_name},#{sj_tele} , #{sj_carplace}) ")
    @Transactional
    void addsj(Driver driver);

    //修改
    @Update("update tb_driver set sj_eno=#{sj_eno}, sj_style=#{sj_style}, sj_number=#{sj_number}, sj_brand=#{sj_brand}, sj_name=#{sj_tele}, sj_tele=#{sj_tele}, sj_carplace=#{sj_carplace} where sj_eno=#{sj_eno}")
    @Transactional
    void updatesj(Driver driver);
    //删除
    @Delete("delete from tb_driver where sj_eno=#{sj_eno}")
    void deletesj(Long sj_eno);

}
